﻿using KayakMes.Check.Application.Input;
using KayakMes.Check.Application.Result;
using KayakMes.Check.Domain;
using KayakMes.Common;
using KayakMes.Common.Dtos;
using KayakMes.Common.Result;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace KayakMes.Check.API.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class ResultController : ControllerBase
    {
        private readonly IResultServer _resultServer;

        public ResultController(IResultServer resultServer)
        {
            _resultServer = resultServer;
        }

        /// <summary>
        /// 检验（合格）
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        /// 
        [HttpPost]
        public ApiResult<int> AddResultOK(AddResultInput input)
        {
           return _resultServer.AddResultOK(input);
        }

        /// <summary>
        /// 检验（不合格）
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        /// 
        [HttpPost]
        public ApiResult<int> AddResultNO(AddResultInput input)
        {
           
            return _resultServer.AddResultNO(input);
        }

        /// <summary>
        /// 获取检验结果
        /// </summary>
        /// <param name="checkCode"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        /// 
        [HttpGet]
        public ApiResult<CheckResullDTOs> GetResull([FromQuery]string checkCode)
        {
           return _resultServer.GetResull(checkCode);
        }
    }
}
